from  PyQt5.QtWidgets import *
import sys
class lineditDemo(QWidget):
    def __init__(self,parent=None):
        super(lineditDemo,self).__init__(parent)
        self.setWindowTitle("Qlinedit例子")
        flo=QFormLayout()
        pnormalLinedit=QLineEdit()
        pnoEchoLinedit = QLineEdit()
        pPasswordLinedit = QLineEdit()
        pPasswordEchoLinedit = QLineEdit()
        flo.addRow("Normal",pnormalLinedit)
        flo.addRow("NoEcho",pnoEchoLinedit)
        flo.addRow("Password",pPasswordLinedit)
        flo.addRow("PasswordEchoonedit",pPasswordEchoLinedit)
        pnormalLinedit.setPlaceholderText("Normal")
        pnoEchoLinedit.setPlaceholderText("NoEcho")
        pPasswordLinedit.setPlaceholderText("Password")
        pPasswordEchoLinedit.setPlaceholderText("PasswordEchoEdit")
        pnormalLinedit.setEchoMode(QLineEdit.Normal)
        pnoEchoLinedit.setEchoMode(QLineEdit.NoEcho)
        pPasswordLinedit.setEchoMode(QLineEdit.Password)
        pPasswordLinedit.setEchoMode(QLineEdit.PasswordEchoOnEdit)
        self.setLayout(flo)
if __name__ == '__main__':
    app = QApplication(sys.argv)
    win = lineditDemo()
    win.show()
    sys.exit(app.exec_())
# QLineEdit.Normal：正常显示所输入的字符，此为默认选项
# QLineEdit.NoEcho：不显示任何输入的字符，常用于密码类型的输入，且长度保密
# QLineEdit.Password：显示与平台相关的密码掩饰字符，而不是实际输入的字符
# QLineEdit.PasswordEchoOnEdit：在编辑时显示字符，负责显示密码类型的输入